package draw;

import pulpcore.sprite.Sprite;
import pulpcore.Stage;
import pulpcore.Input;
import pulpcore.image.CoreGraphics;
import pulpcore.image.Colors;
import pulpfizz.pulp.body.PhysicsLayer;
import pulpfizz.pulp.body.BodySprite;
import pulpfizz.pulp.body.Java2DSprite;
import goliath.BasicDemo;
import org.jbox2d.dynamics.Body;
import org.jbox2d.dynamics.joints.Joint;
import org.jbox2d.common.Vec2;

import java.awt.*;

import edit.EditContext;

/**
 * Simple box outline
 * @author will
 * @date Aug 9, 2008 8:59:40 PM
 */
public class DrawBoxSprite extends DrawSprite {

    public DrawBoxSprite(EditContext ed) {
        super(ed);
    }

    protected void draw(Graphics2D g) {
        Vec2 currVec = ed.mousePos;
        Vec2 vec2 = layer.getCanvasVector(currVec);
        Vec2 vec3 = layer.getCanvasVector(startVec);

        Vec2 size = vec3.sub(vec2).abs();

        g.setColor(Color.green);
        Vec2 upleft = Vec2.min(vec2,vec3);
        g.drawRect(
                (int)upleft.x,(int)upleft.y,
                (int)size.x,(int)size.y);
    }

}
